<?php
include_once "../init.inc.php";
$obn = 0;

    
    if ($_REQUEST['user'] and $_REQUEST['pass']){
            setcookie("user_tbs", $_REQUEST['user'], time()+60*60*24*365);
            setcookie("pwd_tbs", $_REQUEST['pass'], time()+60*60*24*365); 
            setcookie("tbssyns", $_REQUEST['tbssyns']?$_REQUEST['tbssyns']:1, time()+60*60*24*365); 
            setcookie("tbsqual", $_REQUEST['tbsqual'], time()+60*60*24*365); 
        $obn=1;     
    }
   

include_once "../inc/header.php";
/*
if ($_COOKIE ["user_tbs"] and $_COOKIE ["pwd_tbs"]){
    $_REQUEST["user"]=$_COOKIE ["user_tbs"];
    $_REQUEST["pass"]=$_COOKIE ["pwd_tbs"];
}*/
?>
<script>
 $(document).ready(function(){
     user_tbs = $.cookie("user_tbs")!==null?decodeURI($.cookie("user_tbs")):"";  
     pwd_tbs = $.cookie("pwd_tbs")!==null?decodeURI($.cookie("pwd_tbs")):"";  
     maxsyns_tbs = $.cookie("tbssyns")!==null?decodeURI($.cookie("tbssyns")):"";
     quality_tbs = $.cookie("tbsqual")!==null?decodeURI($.cookie("tbsqual")):"";
     $("#tbsusr").val(user_tbs);
     $("#tbspwd").val(pwd_tbs);
     $("#tbssyns").val(maxsyns_tbs);
     $("#tbsqual").val(quality_tbs).attr('selected', true);
     
 });
</script>


        <h1 class="text-info"> Settings </h1>
        <form id ="formsetting" action="" method="get">
            
            The Best Spinner login:<br>
                <input id="tbsusr" type="text" name="user" value="<?=@$_REQUEST["user"]?>" class="texttbs"><br>
        Password:<br>
                <input id="tbspwd" type="password" name="pass" value="<?=@$_REQUEST["pass"]?>" class="texttbs"><br><br>
        Max. synonyms:<br>
                <input id="tbssyns" type="text" name="tbssyns" value="<?=@$_REQUEST["tbssyns"]?>" class="texttbs"><br>
        Rewrite qualiy:<br>
                <select id="tbsqual" name="tbsqual" class="texttbs">
                    <option value="1">Good</option>
                    <option value="2">Better</option>
                    <option value="3">Best</option>
                </select><br><br>        
                <a  class="btn btn-primary" href="#" onclick="document.forms['formsetting'].submit(); return false;"><i class="icon-ok icon-white"></i>&nbsp;Save Settings</a><br />
              <?php // <input class="btn btn-primary" type="submit" name="goopt" value="Save Setting"> ?>
            
        </form>
        
        


<?php 
if ($obn>0){
    $obn = 0;
    ?>  
        <br>
        <div class="alert alert-success">
               <?php  echo "You account settings have been saved";  ?>
         </div>
        <?php
}
include_once "../inc/footer.php"; ?>